home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c++ / 609 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  1.8 KB

  1. From: clamage@Eng.Sun.COM (Steve Clamage)
  2. Message-ID: <4h7935$alj@engnews1.Eng.Sun.COM>
  3. X-Original-Date: 1 Mar 1996 16:36:53 GMT
  4. Path: in1.uu.net!bounce-back
  5. Date: 01 Mar 96 17:13:45 GMT
  6. Approved: fjh@cs.mu.oz.au
  7. Newsgroups: comp.std.c++
  8. Subject: Re: An Extra Virtual Destructor Question t
  9. Organization: Sun Microsystems Inc.
  10. References: <4h5c92$irn@fsgi01.fnal.gov>
  11. Reply-To: clamage@Eng.Sun.COM
  12. X-Auth: PGPMoose V1.1 PGP comp.std.c++
  13.     iQBFAgUBMTcwdeEDnX0m9pzZAQG9RwF8Dav38ycCRNwHXNZtGFeYgS57qDNvnUHq
  14.     99bsRzgailMGVdQLIdV9KUjBMV1YvJ91
  15.     =L8dH
  16.  
  17. In article irn@fsgi01.fnal.gov, b91926@fsgi01.fnal.gov (David Sachs) writes:
  18. >clamage@Eng.Sun.COM (Steve Clamage) writes:
  19.  
  20. >>The compiler will generate calls to the pure virtual destructor if
  21. >>any derived type is destroyed (you can't create objects of type X).
  22. >>If you declare a member function, the compiler does not generate it
  23. >>for you. Thus, if you declare a pure virtual destructor, you usually
  24. >>must implement it as well. 
  25.  
  26. >Do you think it would be a good idea if the standard allowed 
  27. >something like:
  28.  
  29. >class X { virtual ~X()=0 {} } // Combined pure virtual + definition 
  30.  
  31. It complicates the syntax and language definition, and makes the code
  32. harder to read and understand. The code (IMHO) is more subject to errors
  33. in editing and maintaining.
  34.  
  35. In exchange, the suggested syntax saves one line of code in the source text:
  36.     X::~X() { } // 8 tokens
  37.  
  38. It doesn't sound like a good tradeoff to me.
  39.  
  40. ---
  41. Steve Clamage, stephen.clamage@eng.sun.com
  42. ---
  43. [ To submit articles: try just posting with your news-reader.
  44.                       If that fails, use mailto:std-c++@ncar.ucar.edu
  45.   FAQ:      http://reality.sgi.com/employees/austern_mti/std-c++/faq.html
  46.   Policy:   http://reality.sgi.com/employees/austern_mti/std-c++/policy.html
  47.   Comments? mailto:std-c++-request@ncar.ucar.edu.
  48. ]
  49.